package entity

import (
	"time"
)

type GardenMaid struct {
	RoleID   int32 `gorm:"type:int;primary_key"`
	MasterID int32 `gorm:"type:int;primary_key"`
	MaidID   int32
	RoleName string `gorm:"size:255"`
	Num      int32  // 调戏次数
	//Time      time.Time // 调戏恢复时间戳
	CreatedAt time.Time
	UpdatedAt time.Time

	Lv int32 `sql:"-"` // 暂存角色等级
}

// 软禁剩余时间
func (e *GardenMaid) GetSec() int32 {

	return int32(e.CreatedAt.Add(time.Hour * 24).Sub(time.Now()).Seconds())
}

// 是否软禁到期
func (e *GardenMaid) TimeOver() bool {

	return e.GetSec() <= 0
}

// 调戏剩余次数
//func (e *GardenMaid) GetNum(lv int32) (n, sec int32) {
//
//	e.Lv = lv
//
//	var s = time.Now().Sub(e.Time).Seconds()
//
//	n = int32(s) / cd
//	sec = cd - int32(s)%cd
//
//	var conf, _ = level.GetByRoleLevel(e.Lv)
//	if n >= conf.KidMax {
//		n = conf.KidMax
//		sec = 0
//	}
//
//	return n, sec
//}
